﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AmazonMODEL
{
    public static class AmazonExtension
    {
        #region 1.0 转成Amazon FeedType 字符串 +  static string ToAmazonString(this ApiOperationType type)
        /// <summary>
        /// 1.0 转成Amazon FeedType 字符串
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string ToAmazonString(this ApiOperationType type)
        {
            switch (type)
            {
                case ApiOperationType.Product: 
                    return FeedType._POST_PRODUCT_DATA_.ToString();

                case ApiOperationType.Relationship: 
                    return FeedType._POST_PRODUCT_RELATIONSHIP_DATA_.ToString();

                case ApiOperationType.Image: 
                    return FeedType._POST_PRODUCT_IMAGE_DATA_.ToString();

                case ApiOperationType.Price: 
                    return FeedType._POST_PRODUCT_PRICING_DATA_.ToString();

                case ApiOperationType.Inventory:  
                    return FeedType._POST_INVENTORY_AVAILABILITY_DATA_.ToString();

                default:
                    return null;
            }
        }
        #endregion
         
        public static AmazonEnvelopeMessageType ToAmazonMsgType(this ApiOperationType type)
        {
            switch (type)
            { 
                case ApiOperationType.Relationship:
                    return AmazonEnvelopeMessageType.Relationship;

                case ApiOperationType.Image:
                    return AmazonEnvelopeMessageType.ProductImage;

                case ApiOperationType.Price:
                    return AmazonEnvelopeMessageType.Price;

                case ApiOperationType.Inventory:
                    return AmazonEnvelopeMessageType.Inventory;

                default:
                    return AmazonEnvelopeMessageType.Product;
            }
        }
    }
}

